package com.maojianjie.aimee.webautotest.browser;

import java.util.HashMap;
import java.util.Map;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;

import com.maojianjie.aimee.webautotest.Browser;

public class Mobile extends Browser
{
	private String deviceName;

	public Mobile()
	{
		deviceName = "iPhone X";
	}

	public Mobile(String deviceName)
	{
		this.deviceName = deviceName;
	}

	@Override
	protected WebDriver createWebDriver()
	{
		Map<String, String> mobileEmulation = new HashMap<String, String>();
		mobileEmulation.put("deviceName", deviceName);
		Map<String, Object> chromeOptions = new HashMap<String, Object>();
		chromeOptions.put("mobileEmulation", mobileEmulation);
		DesiredCapabilities capabilities = DesiredCapabilities.chrome();
		capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
		WebDriver webDriver = new ChromeDriver(capabilities);
		return webDriver;
	}
}
